package com.pilipili.config;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Interceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
            // 如果是登陆页面则放行
//        System.out.println("uri: " + request.getRequestURI());
//        if (request.getRequestURI().contains("login")) {
//            return true;
//        }
//        HttpSession session = request.getSession();
//        if(session.getAttribute("user") != null) {
//            return true;
//        }
//        request.getRequestDispatcher("login.jsp").forward(request, response);
        return true;
    }
}
